<?PHP
if (isset($_SESSION['lgn']) && $_SESSION['lgn']=="AVADfend3r") {
// Define database connection constants
	define('DB_HOST', 'localhost');
	define('DB_USER', 'phillipv_user1');
	define('DB_PASSWORD', 'pas');
	define('DB_NAME', 'phillipv_AVA');
	
	/*define('DB_USER', 'root');
	define('DB_PASSWORD', 'SQLfender');
	define('DB_NAME', 'masterlog');*/
	
	define('CURRENT_SEASON', '2009');
	
	$dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) or die('Error connecting to MySQL server.');
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>

<?PHP 
$tempArray=array();
$tempCount=0;
$SQLtd='DESCRIBE '.$_GET['tn'].';';
$sendtd=mysqli_query($dbc,$SQLtd) or die($dbc);
while ($RStd = mysqli_fetch_object($sendtd)) {
	$tempArray[]=$RStd->Field;
	$tempCount++;
	print '<td>'.$RStd->Field.', '.$RStd->Type.', '.$RStd->Key.'</td>';
}
	
$SQLgd='SELECT * FROM '.$_GET['tn'].';';
$sendgd=mysqli_query($dbc,$SQLgd) or die(mysqli_error($dbc));
while ($RSgd=mysqli_fetch_object($sendgd)) {
	foreach ($tempArray as $key=>$value) { print $RSgd->$value.','; }
	print '<br />';
}
?>

</body>
</html>
